9 vector
<int> prev
, low
, d
;
10 vector
< vector
<int> > g
;
11 vector
< vector
<bool> > is_bridge
;
16 d
[u
] = low
[u
] = ticks
++;
17 for (int i
=0; i
<g
[u
].size(); ++i
){
24 is_bridge
[u
][v
] = is_bridge
[v
][u
] = true;
26 low
[u
] = min(low
[u
], low
[v
]);
28 low
[u
] = min(low
[u
], d
[v
]);
35 while (scanf("%d", &n
)==1){
36 visited
.assign(n
, false);
40 g
.assign(n
, vector
<int>());
41 is_bridge
.assign(n
, vector
<bool>(n
, false)); //is_bridge[i][j]
42 if (n
== 0){ printf("0 critical links\n\n"); continue; }
44 for (int i
=0; i
<n
; ++i
){
46 scanf("%d (%d)", &node
, °
);
48 for (int k
=0, x
; k
<deg
; ++k
){
55 for (int i
=0; i
<n
; ++i
){
62 for (int i
=0; i
<n
; ++i
) for (int j
=0; j
<n
; ++j
) cnt
+= is_bridge
[i
][j
];
64 printf("%d critical links\n", cnt
);
65 for (int i
=0; i
<n
; ++i
){
66 for (int j
=i
+1; j
<n
; ++j
){
68 printf("%d - %d\n", i
, j
);